---
import { Icon } from 'astro-icon'
export type CalloutType = 'check' | 'error' | 'note' | 'warning'
interface Props {
    title: string
    type: CalloutType
}

const ICON_MAP: Record<CalloutType, string> = {
    'check': 'check-circle',
    'error': 'close-circle',
    'note': 'note',
    'warning': 'warning-circle'
}

const COLOR_MAP: Record<CalloutType, string> = {
    'check': 'text-green-700',
    'error': 'text-red-700',
    'note': ' text-gray-700',
    'warning': 'text-orange-700'
}

const { title, type = 'note' } = Astro.props
---
<div class="callout flex gap-2 w-full bg-gray-200/75 dark:bg-gray-600/75 p-4 rounded-sm shadow-sm">
    <Icon class={`w-6 h-6 inline-block ${COLOR_MAP[type]}`} pack="mdi" name={ICON_MAP[type]} />
    <div class="copy flex flex-col">
        <h4 class={`title m-0 ${COLOR_MAP[type]}`}>{title}</h4>
        <slot/>
    </div>
</div>
